package com.fenxiangle.yueding.feature.focus.view;

import android.annotation.SuppressLint;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.View;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.fenxiangle.yueding.R;
import com.fenxiangle.yueding.entity.bo.GenreClassBo;
import com.fenxiangle.yueding.entity.bo.GenreSeedBo;
import com.fenxiangle.yueding.feature.mine.view.adapter.RequirementGenreClassAdapter;
import com.fenxiangle.yueding.feature.mine.view.adapter.RequirementGenreSendAdapter;
import com.fenxiangle.yueding.framework.DataServer;
import com.suozhang.framework.framework.BaseActivity;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;

/**
 * Created by Home on 2018/9/1.
 */

@SuppressLint("Registered")
public class RequirementGenreActivity extends BaseActivity {
    @BindView(R.id.genre_send)
    RecyclerView genreSend;

    @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
    }

    List<GenreClassBo> publishBos = new ArrayList<>();
    String name[] = {"演绎影视", "经纪主持", "采编/撰稿人", "婚介/文案", "广告", "会议", "技术开发", "设计", "技术安全", "翻译", "律师法务", "企业咨询", "分析师", "教育培训类", "美容整形", "咨询顾问", "金融"};

    @Override
    protected int attachLayoutRes() {
        return R.layout.activity_requirement_genre;
    }

    @Override
    protected void initInjector() {

    }

    List<GenreClassBo> genreSeedBos;
    RequirementGenreSendAdapter genreSendAdapter;
    @Override
    protected void initData() {

//
////        genreClass.setLayoutManager(new LinearLayoutManager(this));
//        genreSend.setLayoutManager(new GridLayoutManager(this, 4));
//        RequirementGenreClassAdapter genreClassAdapter = new RequirementGenreClassAdapter( publishBos);
//        genreSeedBos = publishBos.get(0).getCity();
//        genreSendAdapter = new RequirementGenreSendAdapter( DataServer.getData());
//        genreSend.setAdapter(genreSendAdapter);
////        genreClass.setAdapter(genreClassAdapter);
//        genreClassAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
//            @Override
//            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
//                genreClassAdapter.setSelectItem(position);
//                genreSeedBos = publishBos.get(position).getCity();
//                genreClassAdapter.notifyDataSetChanged();
//                genreSendAdapter = new RequirementGenreSendAdapter(genreSeedBos);
//                genreSend.setAdapter(genreSendAdapter);
//                genreSendAdapter.notifyDataSetChanged();
////                setAdapter();
//            }
//
//        });
        setAdapter();
    }

    private void  setAdapter(){
        genreSendAdapter.setOnItemClickListener(new BaseQuickAdapter.OnItemClickListener() {
            @Override
            public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
                genreSendAdapter.setSelectItem(position);
                genreSendAdapter.notifyDataSetChanged();
            }
        });
    }
}
